package de.mk.util;

import java.util.LinkedList;
import java.util.List;
import java.util.Random;

public class ArrayUtils {

	public static int[] getRandomIntegerArray(int size) {

		List<Integer> remainingNumbers = new LinkedList();		
		for (int i = 1; i <= size; i++) {
			remainingNumbers.add(new Integer(i));
		}

		int[] randomIntArray = new int[size];
		Random random = new Random();

		for (int i = 0; i < size; i++) {
			int nextRandomPosition = Math.abs(random.nextInt())
					% remainingNumbers.size();
			randomIntArray[i] = remainingNumbers.get(nextRandomPosition) - 1;
			remainingNumbers.remove(nextRandomPosition);
		}

		return randomIntArray;
	}

}
